<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" +
            request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html"
      lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>管理后台主页</title>
    <link rel="stylesheet" href="<%=basePath%>static/lib/layui/css/layui.css">
    <script type="text/javascript" src="<%=basePath%>static/lib/layui/layui.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/vue.min.js" type="text/javascript"></script>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header" id="app">
        <div class="layui-logo" style="font-weight: bold">酒店后台管理平台</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <%--                    <img src="http://t.cn/RCzsdCq" class="layui-nav-img">--%>
                    {{username}}
                </a>
                <dl class="layui-nav-child">
                    <%--                    <dd><a href="" target="right">基本资料</a></dd>--%>
                    <%--                    <dd><a href="" target="right">安全设置</a></dd>--%>
                    <dd><a href="${pageContext.request.contextPath}/logout">退出登录</a></dd>
                </dl>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <%-- 用户管理操作只能经理看见--%>
                <shiro:hasRole name="经理">
                    <li class="layui-nav-item layui-nav-itemed">
                        <a class="" href="javascript:;">用户管理</a>
                        <dl class="layui-nav-child">
                            <dd><a href="${pageContext.request.contextPath}/employeeList" target="right">用户列表</a></dd>
                        </dl>
                    </li>
                </shiro:hasRole>
                <%-- 经理可以看见--%>
                <shiro:hasAnyRoles name="经理,前台">
                    <li class="layui-nav-item">
                        <a href="javascript:;">房间管理</a>
                        <dl class="layui-nav-child">
                            <dd><a href="${pageContext.request.contextPath}/roomList" target="right">房间详情</a></dd>
                            <dd><a href="${pageContext.request.contextPath}/myecharts" target="right">房间可视化</a></dd>

                        </dl>
                    </li>
                </shiro:hasAnyRoles>
                <%-- 经理,前台都可以看见--%>
                <shiro:hasAnyRoles name="经理,前台">
                    <li class="layui-nav-item">
                        <a href="javascript:;">商品管理</a>
                        <dl class="layui-nav-child">
                            <dd><a href="${pageContext.request.contextPath}/goodsList" target="right">商品信息</a></dd>
                        </dl>
                        <dl class="layui-nav-child">
                            <dd><a href="${pageContext.request.contextPath}/goodsVisual" target="right">使用分析</a>
                            </dd>
                        </dl>
                    </li>
                </shiro:hasAnyRoles>
                <shiro:hasAnyRoles name="经理,前台">
                    <li class="layui-nav-item">
                        <a href="javascript:;">订单管理</a>
                        <dl class="layui-nav-child">
                            <dd><a href="${pageContext.request.contextPath}/Order/selectOrder"
                                       target="right">订单处理</a>
                                </dd>
                            </dl>
                        </li>
                    </shiro:hasAnyRoles>
                    <shiro:hasAnyRoles name="经理">
                        <li class="layui-nav-item">
                            <a href="javascript:;">财务状况</a>
                            <dl class="layui-nav-child">
                                <dd><a href="${pageContext.request.contextPath}/billInfoVisual" target="right">财务分析</a>
                                </dd>
                            </dl>
                        </li>
                    </shiro:hasAnyRoles>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <!--        <div style="padding: 15px;">内容主体区域</div>-->
        <iframe scrolling="0" rameborder="0" src="" name="right" width="100%" height="98.5%"></iframe>
    </div>

    <div class="layui-footer" style="text-align: center;height: 50px">
        <!-- 底部固定区域 -->
        <p>Copyright &copy; 2015-2023 安逸酒店后台管理</p>
    </div>
</div>
<script th:src="@{layui/layui.js}" type="text/javascript"></script>
<script th:inline="javascript">
    //自动填充模块应该有的内容样式
    layui.use('element', function () {
        var element = layui.element;
    });

    new Vue({
        el:"#app",
        data:{
            username:""
        },
        mounted(){
            this.username = localStorage.getItem("loginUsername");
        }
    })
</script>
</body>
</html>